package com.qf.config;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author 高圆圆
 * @date 2023/2/6 16:21
 * 定义的切面
 */
@Component
@Aspect
public class MyAspect {

    @Pointcut("execution(* *.*.service.impl.*.*(..))")
    public void pt1(){

    }
    @Around("pt1()")
    public Object myAround(ProceedingJoinPoint joinPoint){
        Object obj = null ;

        try {
            System.out.println("前置通知") ;
            //调用业务功能
            obj = joinPoint.proceed() ;
            System.out.println("后置通知") ;
            return obj ;
        } catch (Exception e) {
            e.printStackTrace();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return null ;

    }
}
